Skip to content

Conversation

VictorColomb
Copy link
Contributor

Issue

When generating the name of the virtualenv, Poetry honors PEP 503 project name normalization 1. In short, the name of the project is lowercased, and all runs of -_. are replaced with a single -.

For example, the normalized name of the following extract of pyproject.toml is my-project.

[project]
name = "my_project"

When a project name is modified like this by Poetry, the virtualenv name generated by this project will not match and the Poetry locator will not pick up any Poetry virtual environments (with the exception of the in-project .venv).

PR Description

This PR ports the few lines of Python code from poetry-core 2 that implement the name normalization to the Poetry locator in order to fix this unaligned behavior.

Footnotes

  1. https://peps.python.org/pep-0503/#normalized-names

  2. https://github.com/python-poetry/poetry-core/blob/a2c068227358984d835c9684de723b046bdcd67a/src/poetry/core/_vendor/packaging/utils.py#L46-L51

@VictorColomb
Copy link
Contributor Author

@microsoft-github-policy-service agree

@DonJayamanne DonJayamanne self-requested a review August 21, 2025 11:10
@DonJayamanne DonJayamanne self-assigned this Aug 21, 2025
@VictorColomb
Copy link
Contributor Author

Hi there @DonJayamanne! Any chance you can look at this?

DonJayamanne
DonJayamanne previously approved these changes Oct 8, 2025
@vs-code-engineering vs-code-engineering bot added this to the October 2025 milestone Oct 8, 2025
Tyriar
Tyriar previously requested changes Oct 8, 2025
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Red CI

mjbvz
mjbvz previously approved these changes Oct 8, 2025
@VictorColomb VictorColomb dismissed stale reviews from mjbvz and DonJayamanne via 9491c07 October 8, 2025 11:20
@DonJayamanne DonJayamanne enabled auto-merge (squash) October 9, 2025 06:53
@DonJayamanne DonJayamanne dismissed Tyriar’s stale review October 9, 2025 08:02

Issues addressed

@DonJayamanne DonJayamanne merged commit e97b950 into microsoft:main Oct 9, 2025
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants